<?php


namespace app\partneradmin\model;


use think\Model;

class CustomerServiceAccount extends Model
{

    //自动写入时间
    protected $autoWriteTimestamp = true;

    /**
     * 时间格式化
     * @var string
     */
    protected $dateFormat = 'Y-m-d H:i:s';

    /**
     * 映射客服人员表
     */
    public function CustomerServicePersonnel()
    {
        return $this->hasOne('CustomerServicePersonnel', 'id', 'customer_service_personnel_id')->bind(['personnel_name' => 'name']);
    }

    /**
     * 映射客服组表
     */
    public function CustomerServiceGroup()
    {
        return $this->hasOne('CustomerServiceGroup', 'id', 'customer_service_group_id')->bind(['group_name' => 'name']);
    }

    /**
     * 映射合作方表
     */
    public function Partner()
    {
        return $this->hasOne('Partner', 'id', 'partner_id')->bind(['partner_name' => 'name']);
    }

    /**
     * 映射账号中间表
     */
    public function CustomerServiceAccountMiddle()
    {
        return $this->hasOne('CustomerServiceAccountMiddle', 'customer_service_account_id', 'id')->bind(['customer_service_account_middle_id' => 'id']);
    }
}